//
//  AuditViewController.m
//  HQJFacilitator
//
//  Created by mymac on 2016/10/21.
//  Copyright © 2016年 Fujian first time iot technology investment co., LTD. All rights reserved.
//

#import "AuditViewController.h"
#import "DetailTableViewCell.h"
#import "DetailViewModel.h"

@interface AuditViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong)UITableView *auditTableView;
@property (nonatomic,strong)NSMutableArray *listArray;
@property (nonatomic,assign)NSInteger pages;
@end

@implementation AuditViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    _listArray = [NSMutableArray array];
    _pages = 0;
    [self requst];
    [self.view addSubview:self.auditTableView];
    // Do any additional setup after loading the view.
}
-(UITableView *)auditTableView {
    if (!_auditTableView) {
        _auditTableView = [[UITableView alloc]init];
        _auditTableView.frame = CGRectMake(0, 0, WIDTH, HEIGHT+20);
        _auditTableView.rowHeight = 70.f;

        _auditTableView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        _auditTableView.delegate = self;
        _auditTableView.dataSource = self;
        [_auditTableView registerClass:[DetailTableViewCell class] forCellReuseIdentifier:NSStringFromClass([DetailTableViewCell class])];
//        _auditTableView.mj_footer = [];
        _auditTableView.tableFooterView = [UIView new];
    
    }
    return _auditTableView;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
        return _listArray.count;

}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    DetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([DetailTableViewCell class]) forIndexPath:indexPath];
    cell.isCashList = YES;
    cell.cellModel = _listArray[indexPath.row];

    cell.TitleImageView.image = [UIImage imageNamed:@"shangjia"];
    [cell updateLayout];
    return cell;
    
    
    
    
    
}


#pragma mark --
#pragma mark --- 调用  ViewModel 请求
-(void)requst {
    DetailViewModel *viewModel = [[DetailViewModel alloc]init];
    [viewModel setRequstBlock:^(id ModelBlock) {
        [_listArray addObjectsFromArray:ModelBlock];
        [self.auditTableView reloadData];
        
        HQJLog(@"```````````:%@",ModelBlock);
    }];
    
    
    
    [viewModel requstAppOrgTyp:4 pag:0 andShowView:self.view];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
